package runnable;

class RunnableDemo implements Runnable{
    public void run(){
        while(true){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("hello run");
        }
    }
}

public class demo2 {
    public static void main(String[] args) throws InterruptedException {
        Runnable r1 = new RunnableDemo();
        Thread t = new Thread(r1);
        t.start();
        while (true){
            Thread.sleep(1000);
            System.out.println("hello thread");
        }
    }

}
